#pragma once
#include "../Palette.h"
#include <map>
#include <cstdint>
#include <TinyXML/tinyxml.h>

namespace ECS
{
	class XMLPaletteLoader
	{
	public:
		static std::map<std::string, MetaClass*> _defClasses;

		template <class TComponent, class TDef>
		static void registerClass()
		{
			MetaClass* c = TComponent::_metaTable();
			MetaClass* d = TDef::_metaTable();
			_defClasses[c->name] = d;
		}

		static ComponentDef* parseComponent(MetaClass* c, MetaClass* table, TiXmlElement* componentElement);

		static ComponentDef* ParseComponent(TiXmlElement* componentElement);
		static void Load( ECS::Palette* palette, uint8_t* buf );
		static AssemblyDef* ParseAssembly(TiXmlElement* assemblyElement);
	};
}